<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */

/**
 * User domain model
 *
 * @category    RedCross
 * @package     Core_Model
 */
class Core_Model_User extends RedCross_Gateway_Base_User implements Zend_Acl_Role_Interface
{

    public function isConfirmed()
    {
    	return (bool) $this->is_confirmed;
    }

    public function getEmails()
    {
        $emails = array();
        foreach ($this->Member->emails as $email) {
        	$emails[] = $email->address;
        }
        return $emails;
    }

    static public function createSalt()
    {
    	$salt = '';
    	for ($i = 0; $i < 50; $i++) {
            $salt .= chr(rand(33, 126));
    	}
    	return sha1($salt);
    }

    public function hashPassword($password, $hash)
    {
        return sha1($password . $hash);
    }
    public function getRoleId()
    {
        //return 'user-' . $this->id;
    }
}
